package edu.sctu.liangyuxiang.day20150518;

/**
 * Created by user20 on 2015/5/19.
 */
public class TextMore {
    public Teacher[] teacher;

    public Teacher[] sotrNumber(Teacher[] teacher){
        this.teacher = teacher;
        Teacher[] teacher1 = new Teacher[teacher.length];
        for (int i = 0; i <teacher.length ; i++) {
            for (int j = 0; j <teacher.length ; j++) {
                if(teacher[i].number > teacher[j+1].number){
                    teacher1[0] = teacher[i];
                    teacher[i] = teacher[j+1];
                    teacher[j+1] = teacher1[0];
                }
            }
        }
        return teacher;
    }

    public void sortStudent(Student[] student){
        Student[] stdent1 = new Student[student.length];
        for (int i = 0; i < student.length-1 ; i++) {
            for (int j = 0; j < student.length-1; j++) {
                if(student[i].score > student[j+1].score){
                    stdent1[0] = student[i];
                    student[i] = student[j+1];
                    student[j+1] = student[0];
                }
            }
        }
    }

    public Teacher pritCoded(){
        Teacher teacher2 = null;
        for (int i = 0; i <teacher.length ; i++) {
            if(teacher[i].title.equals("教授")){
                teacher2 = teacher[i];
            }
        }
        return teacher2;
    }
}
